<?php



require_once 'config/config.php';
/**********************************************************************
 * section r�serv� � d'�ventuels traitements ou r�cup�ration de donn�es 
 **********************************************************************/


// traitement modification utilisateur
if(isset($_POST['updatecomp']))
{
	$comp = $_POST['name'];
	$key_comp = $_POST['ckey'];
	$email = $_POST['email'];
	$receive_notice = (isset($_POST['notice']))?1:0;
	$id_comp = $_POST['id_comp'];
	
	if($comp!="" && $key_comp!="" && $email!="")
	{
		
		
		$sql = "
			UPDATE spy_computer
			SET computer='".$comp."',
			key_comp='".$key_comp."',
			mail_comp='".$email."',
			receive_notice='".$receive_notice."'
			WHERE id_comp='".$id_comp."'
			AND fid_account=$id_user
		";
		
		mysql_query($sql);
		
		$msgConf = "Modification effectu&eacute;e.";
	}
}






// fabrication du contenu de la page
if(isset($_GET['id']))
{
	$id = $_GET['id'];
	$sql = "
			SELECT * FROM spy_computer WHERE id_comp=$id AND fid_account=$id_user
	";
	$dataUser = mysql_query($sql);
	$user = mysql_fetch_array($dataUser);
	
	$dataHistory = mysql_query("SELECT * FROM spy_receive WHERE fid_comp=$id ORDER BY id_receive DESC");
	
	
}
else
	$msg = "Pas d'ordinateur s&eacute;lectionn&eacute;";

/**********************************************************************
 * fin de section traitement
 *********************************************************************/


// affichage du template associ� � la page
include "tpl/".$_CONFIG['tpl']."modcomp.php";